package com.crealth.model;

import java.io.Serializable;
import java.sql.Timestamp;

import com.alibaba.fastjson.JSONObject;

public class CdrModel implements Serializable {
	private static final long serialVersionUID = 2801412L;
	private long id;
	private int userID;
	private String callee;
	private int holdTm;
	private int ringingTime;
	private String endreason;
	private Timestamp callTime;
	private String recordName;
	private String dialType;
	
	public CdrModel() {
		id = 0;
		userID = 0;
		callee = "";
		holdTm = 0;
		endreason = "";
		recordName = "";
		ringingTime = 0;
		dialType = "";
	}
	
	public long getId() {
		return id;
	}
	public void setId(long id) {
		this.id = id;
	}
	public int getUserID() {
		return userID;
	}
	public void setUserID(int userID) {
		this.userID = userID;
	}
	public String getCallee() {
		return callee;
	}
	public void setCallee(String callee) {
		this.callee = callee;
	}
	public int getHoldTm() {
		return holdTm;
	}
	public void setHoldTm(int holdTm) {
		this.holdTm = holdTm;
	}	
	public int getRingingTime() {
		return ringingTime;
	}
	public void setRingingTime(int ringingTime) {
		this.ringingTime = ringingTime;
	}
	public String getEndreason() {
		return endreason;
	}
	public void setEndreason(String endreason) {
		this.endreason = endreason;
	}
	public Timestamp getCallTime() {
		return callTime;
	}
	public void setCallTime(Timestamp callTime) {
		this.callTime = callTime;
	}
	public String getRecordName() {
		return recordName;
	}
	public void setRecordName(String recordName) {
		this.recordName = recordName;
	}		
	public String getDialType() {
		return dialType;
	}
	public void setDialType(String dialType) {
		this.dialType = dialType;
	}

	public JSONObject toJSONObject() {
		JSONObject jsonObj = new JSONObject();
		jsonObj.put("id", id);
		jsonObj.put("userID", userID);
		jsonObj.put("callee", callee);
		jsonObj.put("holdTm", holdTm);
		jsonObj.put("callTime", callTime.getTime()/1000);
		if (recordName.length() > 3) {
			jsonObj.put("recordName", recordName);
		}
		
		return jsonObj;
	}
	
}
